package com.example.myapplication;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyDB extends SQLiteOpenHelper {//数据库操作,包括增删改查
    public static final String TABLE_NAME = "NewNote";
    public static final String CONTENT = "content";
    public static final String ID = "_id";
    public static final String TIME = "time";
    public static final String LOCATION="LOCATION";
    public MyDB(Context context) {
        super(context, "NewNote", null,1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {//执行sql创建语句
        String sql ="create table "+TABLE_NAME+" ( "+ID+" integer primary key AUTOINCREMENT, "+CONTENT
                +" TEXT NOT NULL, "+TIME+" TEXT NOT NULL , "+LOCATION+" TEXT )";
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int i, int i1) {

    }
}
